Skip to content

fix: use consistent patch increment for terraform release tags - #488

Merged
lucabello merged 1 commit into
mainfrom
fix/terraform-tag-patch-consistency
Aug 21, 2026
Merged

fix: use consistent patch increment for terraform release tags#488
lucabello merged 1 commit into
mainfrom
fix/terraform-tag-patch-consistency

Conversation

@lucabello

Copy link
Copy Markdown
Contributor

Summary

Branch-based Terraform releases computed the tag's patch number by counting commits touching the terraform path since diverging from main, while explicit-track releases incremented from the highest existing tag's patch. These two approaches diverge whenever the terraform directory is renamed or moved, since commit counting doesn't follow renames. This caused tag creation to fail with "tag already exists" in catalogue-k8s-operator after its terraform module was moved into the charm folder.

Changes

  • Both explicit-track and branch-based releases now compute the patch number the same way: highest existing tf-<major>.<minor>.* tag's patch + 1 (or 0 if none exists)
  • Removed the branch-based git rev-list --count / git merge-base logic, which is no longer needed

Previously, branch-based releases computed the patch number by
counting commits touching the terraform path since diverging from
main, while explicit-track releases incremented from the highest
existing tag. This diverged when the terraform directory was renamed,
causing tag creation to fail with 'tag already exists'.

Both paths now derive the patch number the same way: highest existing
tag's patch + 1, which is robust to directory renames and branch
topology.
@lucabello
lucabello requested a review from a team as a code owner August 21, 2026 08:36
@lucabello
lucabello merged commit be5283b into main Aug 21, 2026
1 check passed
@lucabello
lucabello deleted the fix/terraform-tag-patch-consistency branch August 21, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant